jQuery(document).ready(function() {

    if ($.browser.msie  && parseInt($.browser.version, 10) === 8) {
	
	} else {
		var currentLink = window.location.hash;
		if (currentLink) {
			var currentLinkMonth = currentLink.split(' ')[0];
			var currentLinkYear = currentLink.split(' ')[1];
			currentLinkMonth = currentLinkMonth.replace('#', '');

			var yearContainer = $('h2').find('cufon[alt="' + currentLinkYear + '"]').parent();
			var testingMonth;
			var testingMonthEntity;

			do {
				yearContainer = yearContainer.next();
				testingMonth = yearContainer.children().children().children().attr('alt');
				testingMonthEntity = yearContainer.children().children().children();
			}

			while (testingMonth != currentLinkMonth);
			testingMonthEntity.click();
		}
	}
});

function showHideMonth(sender, currentMonth, languageId, currentLanguage) {
    if ($(sender).parent().children('.impSinBot').length > 0) {
        $(sender).parent().children('.impSinBot').slideToggle('slow', function() {
        var sign = $(sender).parent().children('.impSinTop').children('.impSinTopSign').html();
            if (sign == "+") {
                $(sender).parent().children('.impSinTop').children('.impSinTopSign').html("-");
            } else {
                $(sender).parent().children('.impSinTop').children('.impSinTopSign').html("+");
            }
        });
    } else {
        $(sender).parent().children('.impSinTop').children('.impSinTopSign').html("<img src=\"Content/images/ajax-loader.gif\" alt=\"load\" />");
        httpObject = getHTTPObject();
        if (httpObject != null) {
            var url = "../../../Ajax/getSingleMonth.aspx?monthName=" + currentMonth + "&languageId=" + languageId + "&currentLanguage=" + currentLanguage;
            httpObject.open("GET", url, true);
            httpObject.onreadystatechange = function() {
                if (httpObject.readyState == (1 || 0)) {
                    // do nth
                }
                if (httpObject.readyState == 4) {
                    var response = httpObject.responseText;
                    $(sender).parent().append(response);
                    $(sender).parent().children('.impSinBot').slideToggle('slow', function() {
                        $(sender).parent().children('.impSinTop').children('.impSinTopSign').html("-");
                    });
                } //if state
            }        	//func
            httpObject.send(null);
        } //if
    }
}

/*
    jQuery("#impSinBot-" + sender).slideToggle('slow', function() {
        var sign = jQuery("#impSinTopSign-" + sender).html();
        if (sign == "+") {
            jQuery("#impSinTopSign-" + sender).html("-");
        } else {
            jQuery("#impSinTopSign-" + sender).html("+");
        }
    });
*/
